package com.veng.springbootdemo.po;

import javax.persistence.*;
import java.io.Serializable;

@Entity
public class User implements Serializable{

    //serialVersionUID作用：
    //序列化时为了保持版本的兼容性，即在版本升级时反序列化仍保持对象的唯一性。
    //如果你的类Serialized存到硬盘上面后，可是后来你却更改了类别的field(增加或减少或改名)，
    // 当你Deserialize时，就会出现Exception的，这样就会造成不兼容性的问题。
    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;


    @Column(name = "userName",nullable = false, unique = true)
    private String userName;
    @Column(name = "password",nullable = false)
    private String password;
    @Column(name = "email",nullable = false, unique = true)
    private String email;

    public User() { }

    public User(String userName, String password, String email) {
        this.userName = userName;
        this.password = password;
        this.email = email;
    }
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public void setEmail(String email) {
        this.email = email;
    }



    public String getEmail() {
        return email;
    }
}
